/**
 * 
 */
package org.t2.game.server.module.sensitive;

import org.gaming.ruler.lifecycle.Lifecycle;
import org.gaming.ruler.util.SensitiveUtil;
import org.gaming.ruler.util.SensitiveUtil.SensitiveBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.t2.design.module.MaskWordTable;
import org.t2.design.module.autogen.MaskWordAbstractTable.MaskWordCfg;

/**
 * 
 */
@Service
public class SensitiveService implements Lifecycle {

	private static Logger logger = LoggerFactory.getLogger(SensitiveService.class);
	
	@Override
	public void start() throws Exception {
		SensitiveBuilder builder = SensitiveUtil.newBuilder();
		for(MaskWordCfg cfg : MaskWordTable.ins().all()) {
			builder.addSensitive(cfg.getContent());
		}
		builder.setUp();
		logger.info("加载本地敏感词库{}", MaskWordTable.ins().all().size());
	}

}
